package leetcode.other;

public class number75_not {
    public static void main(String[] args) {
        int[] nums = {2,0,2,1,1,0};
        sortColors(nums);
        for (int i : nums) {
            System.out.println(i);
        }
    }
    public static void sortColors(int[] nums) {
        int left = 0, right = nums.length - 1;
        while(left<right){
            while(left<right && nums[left]<1) left++;
            while(left<right && nums[right]>1) right--;
            if(left<right){
                int temp = nums[left];
                nums[left] = nums[right];
                nums[right] = temp;
            }
        }
    }
}
